package model;

import android.util.Log;
import android.widget.Switch;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2014/11/26.
 */
public class CategoryManager {

    //根据id获取列表
    public List<Map<String, Object>> getCategoryData() {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        String[] father = {"餐饮", "购物"
                , "生活服务", "体育休闲"
                , "医疗保健", "住宿"
                ,"教育文化","交通设施","汽车服务"
                ,"风景名胜","公司企业"
        };
        for (int i = 0; i < father.length; i++) {
            Map<String, Object> map = new HashMap<String, Object>();
            int id = i;
            String name = father[i];
            map.put("id", id);
            map.put("name", name);
            list.add(map);
        }
        return list;
    }

    //获取一级子列表
    public List<Map<String, Object>> getLv1CategoryData(int n) {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        String[] child = null;
        switch (n){
            case 0:
                child = new String[]{"中餐馆", "休闲餐饮"
                        ,"冷饮","甜品"
                        ,"咖啡厅","茶馆"
                        ,"西餐厅","快餐"
                        ,"糕饼"};
                break;
            case 1:
                child = new String[]{
                        "专卖店","化妆品店"
                        ,"体育用品店","便利店"
                        ,"商场","家具建材"
                        ,"家电","文化用品店"
                        ,"宠物店","超级市场"
                };
                break;
            case 2:
                child = new String[]{
                        "中介机构","事务所",
                        "信息咨询中心","售票处",
                        "彩票","搬家公司",
                        "摄影店","物流快递",
                        "洗衣店","邮局",
                };
                break;
            case 3:
                child = new String[]{
                        "休闲场所","健身减肥场所"
                        ,"娱乐场所","度假疗养场所"
                        ,"电影院","体育馆"
                        ,"高尔夫相关"
                };
                break;
            case 4:
                child = new String[]{
                        "专科医院","动物医院"
                        ,"医疗保健销售","急救中心"
                        ,"综合医院","诊所"
                };
                break;
            case 5:
                child = new String[]{
                        "宾馆","招待所"
                        ,"星级酒店","快捷酒店"
                        ,"旅社","假日酒店"
                        ,"商务酒店"
                };
                break;
            case 6:
                child = new String[]{
                        "幼儿园","小学"
                        ,"初中","高中"
                        ,"大学","培训基地"
                        ,"科技馆","会展中心"
                        ,"图书馆","博物馆"
                        ,"科研机构"
                };
                break;
            case 7:
                child = new String[]{
                        "停车场","港口码头"
                        ,"火车站","长途汽车站"
                        ,"飞机场","地铁"
                };
                break;
            case 8:
                child = new String[]{
                        "汽车销售","汽车维修"
                        ,"二手车交易","汽车俱乐部"
                        ,"汽车租凭","洗车场"
                        ,"汽车配件销售","加气站"
                        ,"加油站","汽车救援"
                };
                break;
            case 9:
                child = new String[]{
                        "公园","风景区"
                        ,"名胜古迹"
                };
                break;
            case 10:
                child = new String[]{
                        "公司","工厂"
                        ,"知名企业","农林牧渔基地"
                };
                break;

        }
        for (int i = 0; i < child.length; i++) {

            Map<String, Object> map = new HashMap<String, Object>();
            String name = child[i];
            map.put("name", name);
            list.add(map);
        }
        return list;
    }

    //获取二级子列表列表


}
